import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission'

// import '@/lang'
// console.log(process.env, 'process.env')

// if (process.env.NODE_ENV === 'development') {
//   console.log('代表开发环境')
//   console.log('做开发环境想做的配置')
// } else {
//   console.log('生产环境')
//   console.log('做生产环境想做的配置')
// }

// 全局注册组件
// import PageTools from '@/components/PageTools'
// // Vue.component('PageTools', PageTools)
// const Myplugin = {
//   install(Vue) {
//     Vue.component('PageTools', PageTools)
//   }
// }

// 注册全局自定义指令
Vue.directive('allow', {
  inserted: function(el, binding) {
    const points = store.state.user.userInfo.roles.points
    if (!points.includes(binding.value)) {
      // el.style.display = 'none'
      el.parentNode.removeChild(el)
      // console.log(el, 'elllllll')
    }
    // console.log(el, 'ellllllll')
    // console.log(binding.value, 'bindinggggggggggg')
    // console.log(points, 'pointsssssss')
  }
})

import Components from '@/components'
Vue.use(Components)

Vue.use(ElementUI)

Vue.config.productionTip = false

import i18n from '@/lang'
new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
